package com.godyao.controller;

import com.godyao.enums.ResponseCodeEnum;
import com.godyao.enums.ResultMsg;
import com.godyao.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author godyao
 * @date 2022/3/16
 */
@RestController
public class TestController {
    @Autowired
    private UserDetailsService loginService;


    @GetMapping("/test1")
    public ResultMsg test1() {
        return ResultMsg.builder().code(200).msg("OK").data(null).build();
    }



    @GetMapping("/test2")
    public ResultMsg loadByUsernameTest() {
        return new ResultMsg(ResponseCodeEnum.OK, loginService.loadUserByUsername("zhangsan"));
    }
}
